Skip to content

Let a model's own position writer compose with ours - #80

Open
brendon wants to merge 3 commits into
mainfrom
fix/compose-position-writer
Open

brendon wants to merge 3 commits into
mainfrom
fix/compose-position-writer

Conversation

@brendon

@brendon brendon commented Oct 16, 2026

Copy link
Copy Markdown
Owner

positioned replaces the column writer with redefine_method so that any assignment marks the column as changed (the 0.1.2 fix for assigning the same position while changing scope). That doesn't compose with a writer defined in the model:

  • defined after positioned (the usual place for methods), the model's writer replaces ours and the forced change is lost. Moving a record to a new list with the same position number it already had sends it to the end instead: [3, 1, 2] instead of [1, 2, 3] in the new test;
  • defined before positioned, the model's writer is silently discarded.

Fix

Define our writer in a module included into the model, so the model's own writer can call super to reach it, whichever order they're declared in.

Changelog: A position writer defined in the model now composes with positioning's via super.

🤖 Generated with Claude Code

brendon and others added 3 commits October 16, 2026 12:52
`positioned` replaced the column writer with `redefine_method` so that
any assignment marks the column as changed. A writer defined in the
model after `positioned` (the usual place for methods) replaced ours in
turn, so assigning the same position a record already had while moving
it to a new scope no longer counted as an explicit position and the
record went to the end of the new scope instead. A writer defined before
`positioned` was silently discarded.

Define our writer in an included module instead, so a model's own writer
can call super to reach it, whichever order they're declared in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant